package com.cleaningcloud.erp.mapper;

import java.util.List;

import com.cleaningcloud.erp.domain.ErpProcureDetails;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;

/**
 * 采购明细Mapper接口
 * 
 * @author cleaningcloud
 * @date 2024-09-28
 */
public interface ErpProcureDetailsMapper 
{
    /**
     * 查询采购明细
     * 
     * @param procureDetailsId 采购明细主键
     * @return 采购明细
     */
    ErpProcureDetails selectErpProcureDetailsByProcureDetailsId(Long procureDetailsId);

    /**
     * 查询采购明细列表
     * 
     * @param erpProcureDetails 采购明细
     * @return 采购明细集合
     */
    List<ErpProcureDetails> selectErpProcureDetailsList(ErpProcureDetails erpProcureDetails);

    /**
     * 新增采购明细
     * 
     * @param erpProcureDetails 采购明细
     * @return 结果
     */
    int insertErpProcureDetails(ErpProcureDetails erpProcureDetails);

    /**
     * 修改采购明细
     * 
     * @param erpProcureDetails 采购明细
     * @return 结果
     */
    int updateErpProcureDetails(ErpProcureDetails erpProcureDetails);

    /**
     * 删除采购明细
     * 
     * @param procureDetailsId 采购明细主键
     * @return 结果
     */
    int deleteErpProcureDetailsByProcureDetailsId(Long procureDetailsId);

    /**
     * 批量删除采购明细
     * 
     * @param procureDetailsIds 需要删除的数据主键集合
     * @return 结果
     */
    int deleteErpProcureDetailsByProcureDetailsIds(Long[] procureDetailsIds);

    /**
     * 批量新增
     * @param list
     */
    void batchInsert(@Param("list") List<ErpProcureDetails> list);

    /**
     * @Author Shaw
     * @Description 获取最大批次
     * @date: 2025-07-23 9:18
     * @param: //TODO
     */
    ErpProcureDetails getMaxProcureBatch(ErpProcureDetails erpProcureDetails);

    /**
     * 根据采购单id批量删除
     * @param procureId
     */
    @Delete("delete from erp_procure_details where procure_id = #{procureId}")
    void deleteByProcureId(@Param("procureId") Long procureId);
}
